<?php 
include '../function.php';
try {
	
	$db = new PDO("mysql:host=127.0.0.1;dbname=school;charset=utf8","root",""); 

	
	// $sql = "delete from stu where sid>100";

	// $res = $db->exec($sql);

	// if(!$res){
	// 	exit("错误代码：".$db->errorCode()."错误原因：".$db->errorInfo()[2]);
	// }
	// 
	// $sql = "select * from stu";

	// $res = $db->query($sql);

	// $userList = $res->fetchAll(PDO::FETCH_ASSOC);

	// var_dump($userList[2]['name']);
	// 
	// 
	
	$sql = "insert into stu (name,age) values(:name,:age)";

	$sth = $db->prepare($sql);

	$sth->bindParam(":name", $name, PDO::PARAM_STR,10);
	$sth->bindParam(":age", $age, PDO::PARAM_INT);

	for ($i=0; $i <200 ; $i++) { 
		$name = "小花".$i;
		$age = 30;
		$sth->execute();
	}










} catch (PDOException  $e) {
	echo "有错误".$e;
}















 ?>